﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace canyinguanlixitong
{
    public partial class frm往来业务 : Form
    {
        public frm往来业务()
        {
            InitializeComponent();
        }
        string str = "Data Source=.;Initial Catalog=Supermarket management system;Integrated Security=True";
    
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(str);
            string sql = @"select danwei,danjuhaoid,spName,spJia,sum,slLei
from dbo.sangping,dbo.单据号,dbo.commodity,[Commodity type]
where dbo.sangping.单据号=dbo.单据号.danjuhaoid 
and dbo.commodity.spID=dbo.sangping.commid
and [Commodity type].SlId=commodity.spLei and danjuhaoid like'%"+this.textBox1.Text+"%'";
            DataSet ds = new DataSet("Student");
            SqlDataAdapter asdf = new SqlDataAdapter(sql,conn);
            asdf.Fill(ds,"Student");
            this.dataGridView1.DataSource = ds.Tables["Student"];
        }
    }
}
